<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			const stu = {
				name: '张三',
				age: 20,
				study: function() {
					console.log("学习");
				}
			}
			const stu2 = {
				name: '李四',
				age: 30,
				study: function() {
					console.log("学习");
				}
			}

			function Student(name, age) {
				this.name = name;
				this.age = age;
				this.study = function() {
					console.log("学习");
				}
			}
			const s1 = new Student('张三', 20);
			const s2 = new Student('李四', 30);

			/*
			   类:
			   class 类名 {
				 属性(一般属性，私有属性，静态属性);
				 constructor(name, age) {//构造方法
				 	this.name = name;
				 	this.age = age;
				 }
				 行为
			   }
									    
			  构造函数:
			    创建对象时，给对象的属性赋初始化值
			*/
			class Worker {
				constructor(name, age) {
					this.name = name;
					this.age = age;
				}
				work() {
					console.log('工作');
				}
			}

			const w1 = new Worker('张三', 20);
			
			console.dir(Worker);
		</script>
	</body>
</html>
